import { http } from "@/utils/http";
import type { R } from "@/types/api";

/** 标签详情 */
export interface TagVO {
  tagId: number;
  name: string;
  createdAt: string;
  usageCount?: number;
}

/** 获取所有标签 */
export const getAllTags = () => {
  return http.get<R<TagVO[]>>("tags/all");
};

/** 通过标签ID查询有多少文章 */
export const getArticleCountByTagId = (tagId: number) => {
  return http.get<R<number>>(`tags/count/${tagId}`);
};

/** 通过标签名称查询有多少文章 */
export const getArticleCountByTagName = (tagName: string) => {
  return http.get<R<number>>(`tags/count/name/${tagName}`);
}; 